home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / do1beta.zip / CRDEMO.DO < prev    next >
Text File  |  1991-08-25  |  4KB  |  179 lines

  1. /*#############################################################################
  2. Name:        CRDEMO.DO
  3. Version:    2.0
  4. Date:        8/25/91
  5. Description:    create DBASE files for demo application DEMO.DO
  6.         Copyright (c) 1991 Intelligent Systems Research
  7.         Permission granted to copy or re-use without restriction
  8. #############################################################################*/
  9.  
  10. /*
  11.     create the OFFICE database
  12.     this file stores the cost center codes for each location
  13. */
  14. office = createDbf("office",[    
  15.     ["ccenter",'N',4,0],        % cost center id (4-digit numeric)    
  16.     ["location",'C',24,0]]);    % name of location
  17.  
  18. /*
  19.     store records for existing cost centers (offices)
  20. */
  21. ccenter = 1000;
  22. location = "Chicago";
  23. write(office,0L);
  24. ccenter = 1001;
  25. location = "New York";
  26. write(office,0L);
  27. ccenter = 1002;
  28. location = "San Fransisco";
  29. write(office,0L);
  30. ccenter = 1003;
  31. location = "Dallas";
  32. write(office,0L);
  33. close(office);
  34. ? "Office (Cost Center) database created";
  35.  
  36. /*
  37.     create the DOCTOR database
  38.     this database stores the ID and names of all current doctors
  39. */    
  40. doctor = createDbf("doctor",[
  41.     ["docid",'N',4,0],    % 4-digit ID (numeric)
  42.     ["lname",'C',32,0],    % last name
  43.     ["fname",'C',24,0],    % first name
  44.     ["indate",'D',0,0]]);    % date this doctor started
  45.     
  46. /*
  47.     store some doctor records
  48. */
  49. docid = 1;
  50. lname = "Jones";
  51. fname = "Joseph";
  52. indate = date();
  53. write(doctor,0L);
  54. docid = 2;
  55. lname = "Smith";
  56. fname = "Stanley";
  57. indate = date();
  58. write(doctor,0L);
  59. close(doctor);
  60. ? "Doctor database created";
  61.  
  62. /*
  63.     create the officed database
  64.     this file stores the doctors assigned to each office
  65.  
  66.     Assumptions:
  67.     each doctor can be assigned to one or more offices
  68.  
  69. */
  70. officed = createDbf("officed",[
  71.     ["ccenter",'N',4,0],    % cost center id (4-digit numeric)
  72.     ["docid",'N',4,0]]);    % case worker id (4-digit numeric)
  73.  
  74. /*
  75.     store some doctor assignments
  76. */
  77. ccenter = 1000;
  78. docid = 1;
  79. write(officed,0L);
  80. ccenter = 1001;
  81. docid = 1;
  82. write(officed,0L);
  83. ccenter = 1000;
  84. docid = 2;
  85. write(officed,0L);
  86. ccenter = 1002;
  87. docid = 1;
  88. write(officed,0L);
  89. close(officed);
  90. ? "Office - Doctor table created";
  91.  
  92.     
  93. /*
  94.     create the BILLRATE database
  95.     this file stores the history of billing rates for a patient
  96. */
  97. billrate = createDbf("billrate",[
  98.     ["caseno",'C',7,0],    % patient ID (case number)
  99.     ["date",'D',0,0],    % date this billing rate entered
  100.     ["rate",'N',8,0]]);    % billing rate for this patient ($/hour)
  101. ? "Billing rate database created";
  102.  
  103.  
  104. /*
  105.     create the patient database
  106. */
  107. patient = createDbf("patient",[
  108.     ["caseno",'C',7,0],    % case number
  109.     ["lname",'C',14,0],    % patient last name
  110.     ["fname",'C',14,0],    % patient first name
  111.     ["indate",'D',0,0],    % date that this person became a patient
  112.     ["program",'N',4,0],    % program ID
  113.     ["docid",'N',4,0]]);    % ID of doctor assigned to this patient
  114.  
  115. /*
  116.     create the VISIT database
  117.     store one record for each visit for each patient
  118. */
  119. visit = createDbf("visit",[
  120.     ["caseno",'C',7,0],
  121.     ["date",'D',0,0],
  122.     ["service",'C',1,0],
  123.     ["diag1",'C',5,0],
  124.     ["diag2",'C',5,0],
  125.     ["proc1",'C',8,0],
  126.     ["proc2",'C',8,0],
  127.     ["proc3",'C',8,0],
  128.     ["proc4",'C',8,0],
  129.     ["hours",'N',2,0],
  130.     ["due",'N',6,2],
  131.     ["paid",'N',6,2],
  132.     ["scale",'N',6,2]]);
  133.  
  134. for(i=0;i<10;i=i+1) {
  135.  
  136. /*
  137.     create a patient record for this patient
  138. */
  139.     select(patient);
  140.     caseno = "00311"+asString(i)+"A";
  141.     mcaseno = caseno;
  142.     lname = "LASTNAME"+asString(i);
  143.     fname = "FIRSTNAME"+asString(i);
  144.     docid = 1;
  145.     write(patient,0L);
  146.  
  147. /*
  148.     create a billing rate record for this new patient
  149. */
  150.     select(billrate);
  151.     caseno = mcaseno;
  152.     date = date();
  153.     rate = i;
  154.     write(billrate,0L);
  155.         
  156. /*
  157.     create a series of visits for this patient on different dates
  158. */
  159.     number_of_visits = 5;
  160.     for(j=0; j < number_of_visits; j=j+1) {
  161.         select(visit);
  162.         caseno = mcaseno;
  163.         date = date()+j;
  164.         service='A';
  165.         hours = i;
  166.         due=hours*70.0;
  167.         paid = 0;
  168.         scale = 0;
  169.         write(visit,0L);
  170.         ? recno(visit);
  171.     }
  172. }
  173.  
  174. close(patient);
  175. close(visit);
  176. close(billrate);
  177. ? "Patient and Visit databases created";
  178.  
  179.